home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14091 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: nntp.teleport.com!usenet
  2. From: GHouck <hksys@teleport.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Question on pointers
  5. Date: 11 Apr 1996 20:32:52 GMT
  6. Organization: systems hk
  7. Message-ID: <4kjq9k$34m@nadine.teleport.com>
  8. References: <1996Apr8.233330.139449@forest>
  9. NNTP-Posting-Host: ip-pdx09-42.teleport.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
  14.  
  15. ebromber@forest.drew.edu wrote:
  16. >In a program there is an array of structs. One of the headers for a 
  17. >function says void pop(stack *). My question is shouldn't there be a name 
  18. >or identifier after the asterisk? My friend says that it is the address of 
  19. >a stack in the array. If this is true, how could I access the thing 
  20. >pointed to?
  21. >Here are some lines which define a stack
  22. >
  23. >typedef struct item item;
  24. >struct item {
  25. >    struct item *next;
  26. >    char c;
  27. >    }
  28. >typedef item *stack;
  29. >
  30. My assumption would be that your header file that contains the function
  31. prototype, is indicating that function 'pop' takes a pointer to a type
  32. called 'stack'.  It doesn't have to give you the actual variable name,
  33. although it could provide a meaningful example; e.g., void pop ( stack *Pstack );
  34. The actual declaration of instance(s) of the type 'stack' are what you 
  35. would use in any call to 'pop'.
  36. Yours, Geoff Houck
  37.  
  38.  
  39.  
  40.